﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserMessages.ascx.cs"
	Inherits="RedeSocial.Web.UserMessages" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="RedeSocial.ViewModels" Namespace="RedeSocial.ViewModels" TagPrefix="vm" %>
<%@ Register Src="Likes.ascx" TagName="Likes" TagPrefix="uc1" %>
<%@ Register Src="Dislike.ascx" TagName="Dislike" TagPrefix="uc2" %>
<style type="text/css">
	.style9
	{
		width: 62px;
		height: 58px;
	}
	.style17
	{
		width: 589px;
		height: 58px;
	}
</style>
<link href="/Styles/Style.css" rel="stylesheet" type="text/css" />
<table>
	<tr>
		<td>
			<asp:Label ID="lblShare" runat="server" CssClass="Label" Text="<%$ Code: ResourceManager.GetResource(Constants.USERMESSAGES_SHARELABEL, Language.Id) %>"></asp:Label>
		</td>
		<td>
			&nbsp;
		</td>
	</tr>
</table>
<table style="width: 100px;">
	<tr>
		<td style="width: 1px">
			<asp:Image ID="imgMsg" runat="server" ImageUrl="~/Pics/messages.jpg" />
		</td>
		<td>
			<telerik:RadTextBox ID="txtShareMsg" runat="server" EmptyMessage="Share Something:"
				Width="148px">
			</telerik:RadTextBox>
			<telerik:RadButton ID="btnSubmit" runat="server" CssClass="Buttons" Height="20px"
				Text="Submit" Width="60px" OnClick="btnSubmit_Click">
			</telerik:RadButton>
		</td>
	</tr>
	<tr>
		<td>
			<asp:Image ID="imgSharedFoto" runat="server" ImageUrl="~/Pics/photo.jpg" />
		</td>
		<td>
			<telerik:RadAsyncUpload ID="rauSharedFoto" runat="server" MaxFileInputsCount="1"
				Width="250px">
			</telerik:RadAsyncUpload>
		</td>
	</tr>
	<tr>
		<td>
			<asp:Image ID="imgSharedVideo" runat="server" ImageUrl="~/Pics/video.jpg" />
		</td>
		<td>
			<telerik:RadAsyncUpload ID="rauSharedVideo" runat="server" MaxFileInputsCount="1"
				Width="250px">
			</telerik:RadAsyncUpload>
		</td>
	</tr>
	<tr>
		<td colspan="2">
		</td>
	</tr>
</table>
<table>
	<tr>
		<td>
			<telerik:RadListView ID="ListViewMessages" runat="server" AllowPaging="True" ItemPlaceholderID="MessagesContainer"
				DataKeyNames="Id" DataSourceID="NewsEntity">
				<LayoutTemplate>
					<fieldset>
						<legend>Messages</legend>
						<asp:PlaceHolder ID="MessagesContainer" runat="server" />
					</fieldset>
				</LayoutTemplate>
				<ItemTemplate>
					<table>
						<tr>
							<td>
								<table>
									<tr>
										<td class="style9">
											<telerik:RadBinaryImage ID="imgUserComment" runat="server" DataValue='<%# Eval("User.File.Object") %>'
												AutoAdjustImageControlSize="False" Height="30px" ResizeMode="Fit" Width="30px" />
										</td>
										<td class="style17">
											<table>
												<tr>
													<td>
														<asp:Label ID="lbl" runat="server" Text='<%# Eval("User.Name") %>' CssClass="Label"></asp:Label>
													</td>
												</tr>
												<tr>
													<td>
														<asp:Label ID="lblMessage" runat="server" CssClass="LabelThin" Text='<%# Eval("Message") %>'></asp:Label>
													</td>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td colspan="2">
											<table>
												<tr>
													<td>
														<uc1:Likes ID="CommentLikes" runat="server" />
													</td>
													<td>
														<uc2:Dislike ID="ComentDislike" runat="server" />
													</td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td>
								<telerik:RadListView ID="ListViewComments" runat="server" ItemPlaceholderID="CommentsContainer"
									DataSource='<%# Eval("Comments") %>' NewsId='<%# Eval("Id") %>' InsertItemPosition="FirstItem"
									OnItemInserting="ListViewComments_ItemInserting">
									<LayoutTemplate>
										<fieldset>
											<legend>Comments</legend>
											<asp:PlaceHolder ID="CommentsContainer" runat="server" />
											<table>
												<tr>
													<td valign="middle">
														<telerik:RadTextBox ID="txtComment" runat="server" EmptyMessage="Write a comment..."
															Width="150px" NewsId='<%# Eval("Id") %>' />
													</td>
													<td valign="middle">
														<telerik:RadButton ID="btnSubmitComment" runat="server" Text="Insert" 
															CommandName="PerformInsert" onclick="btnSubmitComment_Click" />
													</td>
												</tr>
											</table>
										</fieldset>
									</LayoutTemplate>
									<ItemTemplate>
										<table>
											<tr>
												<td>
													<telerik:RadBinaryImage ID="imgCommentUser" runat="server" DataValue='<%# Eval("User.File.Object") %>'
														Height="30px" ResizeMode="Fit" Width="30px" />
												</td>
												<td>
													<table>
														<tr>
															<td>
																<asp:Label ID="lblCommentUserName" runat="server" Text='<%# Eval("User.Name") %>'
																	CssClass="Label"></asp:Label>
																&nbsp;<asp:Label ID="lblCommentMessage" runat="server" Text='<%# Eval("Message") %>'
																	CssClass="LabelThin"></asp:Label>
															</td>
														</tr>
													</table>
												</td>
											</tr>
										</table>
									</ItemTemplate>
									<InsertItemTemplate>
										<fieldset style="float: left; width: 280px;">
											<table>
												<tr>
													<td valign="middle">
														<telerik:RadTextBox ID="txtComment" runat="server" EmptyMessage="Write a comment..."
															Width="150px" Text='<%# Bind("Message") %>' />
													</td>
													<td valign="middle">
														<telerik:RadButton ID="btnSubmitComment" runat="server" Text="Insert" />
													</td>
												</tr>
												<tr>
													<td>
														&nbsp;
													</td>
													<td>
														&nbsp;
													</td>
													<td>
														&nbsp;
													</td>
												</tr>
											</table>
										</fieldset>
									</InsertItemTemplate>
									<%--										<SortExpressions>
											<telerik:RadListViewSortExpression FieldName="Posted" />
										</SortExpressions>
									--%>
								</telerik:RadListView>
							</td>
						</tr>
					</table>
				</ItemTemplate>
			</telerik:RadListView>
			<asp:EntityDataSource ID="NewsEntity" runat="server" ConnectionString="name=RedeSocialEntities"
				DefaultContainerName="RedeSocialEntities" EntitySetName="News" OnQueryCreated="NewsEntity_QueryCreated"
				Include="File, Comments, NewsType, User, NewsLikeDislikes, User.File, Comments.User.File, Comments.NewsLikeDislikes"
				EnableUpdate="True" EnableInsert="True" EntityTypeFilter="" />
		</td>
	</tr>
</table>
